package com.mrs.controller;

import com.mrs.annotation.SystemLog;
import com.mrs.common.ResponseResult;
import com.mrs.entity.User;
import com.mrs.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * description: UserController
 * date: 2022/8/10 19:14
 * author: MR.孙
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    //个人信息查询
    @GetMapping("/userInfo")
    public ResponseResult userInfo(){
        return userService.userInfo();
    }

    //更新个人信息
    @PutMapping("/userInfo")
    @SystemLog(businessName = "更新用户信息")
    public ResponseResult updateUserInfo(@RequestBody User user){
        return userService.updateUserInfo(user);
    }

    //注册用户
    @PostMapping("/register")
    public ResponseResult register (@RequestBody User user){
        return userService.register(user);
    }

}
